package co.edu.unal.scrum.client.projects;

import co.edu.unal.scrum.client.LayoutPresenter;
import co.edu.unal.scrum.client.place.LoggedInGatekeeper;
import co.edu.unal.scrum.client.place.NameTokens;

import com.google.gwt.event.shared.EventBus;
import com.google.gwt.event.shared.GwtEvent.Type;
import com.google.gwt.event.shared.HasHandlers;
import com.google.inject.Inject;
import com.gwtplatform.mvp.client.HasUiHandlers;
import com.gwtplatform.mvp.client.Presenter;
import com.gwtplatform.mvp.client.View;
import com.gwtplatform.mvp.client.annotations.ContentSlot;
import com.gwtplatform.mvp.client.annotations.NameToken;
import com.gwtplatform.mvp.client.annotations.ProxyCodeSplit;
import com.gwtplatform.mvp.client.annotations.UseGatekeeper;
import com.gwtplatform.mvp.client.proxy.ProxyPlace;
import com.gwtplatform.mvp.client.proxy.RevealContentEvent;
import com.gwtplatform.mvp.client.proxy.RevealContentHandler;

public class ProjectsPresenter extends
		Presenter<ProjectsPresenter.MyView, ProjectsPresenter.MyProxy> implements  HasHandlers,ProjectsUiHandles {

	public interface MyView extends View ,HasUiHandlers<ProjectsUiHandles>{
	}

	@ProxyCodeSplit
	@NameToken(NameTokens.projects)
	@UseGatekeeper(LoggedInGatekeeper.class)
	public interface MyProxy extends ProxyPlace<ProjectsPresenter> {
	}
	@ContentSlot
	public static final Type<RevealContentHandler<?>> TYPE_BOTTOM = new Type<RevealContentHandler<?>>();

	private ProjectEditorPresenter editorPresenter;


	@Inject
	public ProjectsPresenter(final EventBus eventBus, final MyView view,
			final MyProxy proxy,final ProjectEditorPresenter editorPresenter) {
		super(eventBus, view, proxy);
		this.editorPresenter=editorPresenter;
		getView().setUiHandlers(this);
	}

	@Override
	protected void revealInParent() {
		RevealContentEvent.fire(this, LayoutPresenter.TYPE_CENTER, this);
	}

	@Override
	protected void onBind() {
		super.onBind();
	}

	@Override
	public void onEditButtonClicked() {
		// TODO Auto-generated method stub
		
	}
	@Override
	protected void onReset() {
		// TODO Auto-generated method stub
		super.onReset();

	}

	@Override
	public void onAddButtonClicked() {
		// TODO Auto-generated method stub
		editorPresenter.reset();
		addToPopupSlot(editorPresenter);
	}
}
